<template>
  <div id="purposeDiv">
    <Breadcrumb content="微生物检验目的" />
    <div class="bodyContent">
      <Splitpanes>
        <!-- 左侧表格  -->
        <Pane size="62">
          <vxe-toolbar perfect>
            <template #buttons>
              <vxe-input style="width: 180px" v-model="searchForm.searchValue" type="search" clearable class="vxeInputSearch" placeholder="关键字查询" @clear="findPurposeList" @keyup="keyupEnter" @search-click="findPurposeList()"></vxe-input>
              <div class="smallToolTitle">
                工作组</div>
              <vxe-select v-model="searchForm.rptGroup" @change="valueChangeEvent" clearable>
                <vxe-option v-for="rptGroup in rptGroupList" :key="rptGroup.id" :label="rptGroup.rptGroupName" :value="rptGroup.id"></vxe-option>
              </vxe-select>
              <vxe-button type="text" class="button-blue" icon="vxe-icon-refresh" content="刷新" :loading="tloading" @click="findPurposeList"></vxe-button>
              <vxe-button type="text" class="button-blue" icon="vxe-icon-square-plus" content="新建" @click="addPurposeDialog()"></vxe-button>
              <vxe-button type="text" icon="vxe-icon-delete" class="button-red" content="删除" @click="deleteBatchPurpose"></vxe-button>
            </template>
          </vxe-toolbar>
          <div class="tableBody">
            <vxe-table ref="purposeTableRef" class="mytable-scrollbar supplierTableClazz" border="inner" align="left" height="auto" :data="purposeList" :loading="tloading" @current-change="purposeRowClick" :row-config="{ isCurrent: true, isHover: true }" :column-config="{ resizable: true }" resizable show-overflow keep-source>
              <vxe-column type="checkbox" width="30"></vxe-column>
              <vxe-column field="seq" title="序号" width="80"></vxe-column>
              <vxe-column field="purposeNo" title="检验目的代码" width="80"></vxe-column>
              <vxe-column field="purposeName" title="检验目的名称" width="200">
              </vxe-column>
              <vxe-column field="sampleTypeName" title="默认标本类型" width="100">
              </vxe-column>
              <vxe-column field="workFlowName" title="默认方案流程" width="100">
              </vxe-column>
              <vxe-column field="cultureCombinationName" title="默认培养基组合" width="100">
              </vxe-column>

              <vxe-column field="inputCode" title="助记符" width="100">
                <template #default="{ row }">
                  <span>{{ row.inputCode }}</span>
                </template>
              </vxe-column>
              <vxe-column field="contact" title="涂片专用" width="100">
                <template #default="{ row }">
                  <span>{{ formatCommon(smearFlagList, row.smearFlag) }}</span>
                </template>
              </vxe-column>
              <vxe-column field="sampleNoRuleName" title="编号规则" width="100">
              </vxe-column>
              <vxe-column field="sampleRemark" title="默认标本备注" width="120">
              </vxe-column>
              <vxe-column field="minReportHour" title="最小发报告小时数" width="80"></vxe-column>
              <vxe-column field="maxReportHour" title="最小发报告小时数" width="80"></vxe-column>
              <vxe-column field="defInputMdl" title="默认输入模板" width="100">
              </vxe-column>
              <vxe-column field="exbarCount" title="附加条码数" width="80"></vxe-column>
              <vxe-column field="bloodCulture" title="血培养标记" width="80">
                <template #default="{ row }">
                  <vxe-checkbox v-model="row.bloodCulture"></vxe-checkbox>
                </template>
              </vxe-column>
              <vxe-column field="ygFlag" title="院感标识" width="80">
                <template #default="{ row }">
                  <vxe-checkbox v-model="row.ygFlag"></vxe-checkbox>
                </template>
              </vxe-column>
              <vxe-column field="purposeKind" title="检验目的类别" width="100">
              </vxe-column>
              <vxe-column field="rptGroupName" title="报告单元" width="100">
              </vxe-column>

            </vxe-table>
          </div>
        </Pane>
        <!-- 右侧表单 -->
        <Pane size="38">
          <el-tabs type="border-card" v-model="activeName" @tab-click="tabHandleClick">
            <el-tab-pane label="基础信息" name="first">
              <el-form ref="purposeFormRef" :model="purposeForm" :rules="purposeFormRule" label-width="100px" inline-message>
                <el-row>
                  <el-col :span="12">
                    <el-form-item prop="purposeNo" label="检验目的代码">
                      <el-input type="text" v-model="purposeForm.purposeNo" placeholder="请输入检验目的代码" clearable></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="purposeKind" label="类别">
                      <el-input type="text" v-model="purposeForm.purposeKind" placeholder="请输入" clearable></el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="12">
                    <el-form-item prop="purposeName" label="检验目的名称">
                      <el-input type="text" v-model="purposeForm.purposeName" placeholder="请输入检验目的名称	" @blur="getBdsResult()" clearable></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="inputCode" label="助记符">
                      <el-input type="text" v-model="purposeForm.inputCode" placeholder="请输入助记符" clearable></el-input>
                    </el-form-item>
                  </el-col>

                  <el-col :span="12">
                    <el-form-item prop="sampleTypeId" label="默认标本类型">
                      <SelectDataList ref="sampleTypeSelectRef" :url="'/api/lab/labSampleType/findSampleTypeList'" :displayField="[
                          { title: '编码', props: 'sampleTypeCode' }, //列标题
                          { title: '名称', props: 'sampleTypeName' }
                        ]" :placeholder="'请选择'" :inputKeyName="'keyWords'" @selectDataRow="sampleTypeSelect" @clearValue="clearSampleTypeName" @sliceValue="sliceSampleTypeHandler" v-model="purposeForm.sampleTypeName" :isPage="false" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="workFlowId" label="默认方案流程">
                      <SelectDataList ref="workFlowSelectRef" :url="'/api/bac/bac-work-flow/findBacWorkFlowList'" :displayField="[
                          { title: '编码', props: 'workFlowCode' }, //列标题
                          { title: '名称', props: 'workFlowName' }
                        ]" :placeholder="'请选择'" :inputKeyName="'keyWords'" @selectDataRow="workFlowSelect" @clearValue="clearWorkFlowName" @sliceValue="sliceWorkFlowHandler" v-model="purposeForm.workFlowName" :isPage="false" />
                    </el-form-item>
                  </el-col>

                  <el-col :span="12">
                    <el-form-item prop="cultureCombinationId" label="默认培养基组合">
                      <SelectDataList ref="cultureCombinationSelectRef" :url="'/api/bac/bac-cultrue-combination/findBacCultureCombinationList'" :displayField="[
                          { title: '编码', props: 'code' }, //列标题
                          { title: '名称', props: 'name' }
                        ]" :placeholder="'请选择'" :inputKeyName="'searchValue'" @selectDataRow="cultureCombinationSelect" @clearValue="clearCultureCombinationName" @sliceValue="sliceCultureCombinationHandler" v-model="purposeForm.cultureCombinationName" :isPage="false" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="sampleRemark" label="默认标本备注">
                      <el-input type="text" v-model="purposeForm.sampleRemark" placeholder="请输入" clearable></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="sampleNoRule" label="标本编号规则">
                      <SelectDataList ref="ruleSetSelectRef" :url="'/api/rule/set/getSysRuleSetList'" :displayField="[
                          { title: '编码', props: 'ruleCode' }, //列标题
                          { title: '名称', props: 'ruleName' }
                        ]" :placeholder="'请选择'" :inputKeyName="'keyWords'" @selectDataRow="sampleNoRuleSelect" @clearValue="clearSampleNoRuleName" @sliceValue="sliceSampleNoRuleHandler" v-model="purposeForm.sampleNoRuleName" :isPage="false" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="rptGroup" label="报告单元">
                      <el-select v-model="purposeForm.rptGroup" filterable placeholder="请选择">
                        <el-option v-for="rptGroup in rptGroupList" :key="rptGroup.id" :label="rptGroup.rptGroupName" :value="rptGroup.id"></el-option>
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="血培养" prop="bloodCulture">
                      <el-switch v-model="purposeForm.bloodCulture" inline-prompt active-text="是" inactive-text="否"></el-switch>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item label="院感标识" prop="ygFlag">
                      <el-switch v-model="purposeForm.ygFlag" inline-prompt active-text="是" inactive-text="否"></el-switch>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="defInputMdl" label="默认输入模板"><!--阴性结果-->
                      <el-input type="text" v-model="purposeForm.defInputMdl" placeholder="请输入" clearable></el-input>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="smearFlag" label="是否涂片">
                      <el-select v-model="purposeForm.smearFlag" placeholder="请选择">
                        <el-option v-for="item in smearFlagList" :key="item.code" :label="item.name" :value="item.code" />
                      </el-select>
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="exbarCount" label="附加条码数">
                      <el-input-number v-model="purposeForm.exbarCount" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="minReportHour" label="报告小时数最少">
                      <el-input-number v-model="purposeForm.minReportHour" :min="1" :max="1000" />
                    </el-form-item>
                  </el-col>
                  <el-col :span="12">
                    <el-form-item prop="maxReportHour" label="报告小时数最大">
                      <el-input-number v-model="purposeForm.maxReportHour" :min="1" :max="1000" />
                    </el-form-item>
                  </el-col>

                  <el-col :span="12">
                    <el-form-item prop="seq" label="序号">
                      <el-input-number v-model="purposeForm.seq" :min="1" :max="1000" />
                    </el-form-item>
                  </el-col>

                  <el-col :span="24">
                    <el-form-item class="form-footer">
                      <template #default>
                        <el-button type="primary" @click="savePurpose('purposeFormRef')">保存</el-button>
                        <!-- <el-button type="default" @click="resetForm()">重置</el-button> -->
                      </template>
                    </el-form-item>
                  </el-col>
                </el-row>
              </el-form>
            </el-tab-pane>
            <el-tab-pane label="首选方案" name="second" :disabled="isEmpty(purposeForm.purposeNo)">
              <BacReqPurposeDetail ref="purposeDetailRef" />
            </el-tab-pane>
            <el-tab-pane label="备选方案" name="third" :disabled="isEmpty(purposeForm.purposeNo)">
              <BacReqPurposeBxInfo ref="purposeBxInfoRef" />
            </el-tab-pane>
            <el-tab-pane label="标本类型" name="four" :disabled="isEmpty(purposeForm.purposeNo)">
              <BacReqSampleType ref="sampleTypeRef" />
            </el-tab-pane>
          </el-tabs>
        </Pane>
      </Splitpanes>
    </div>
  </div>
</template>
<script setup lang="ts">
// 引入组件区 ==========
import { ref, reactive, getCurrentInstance, onMounted } from 'vue';
import Breadcrumb from '@/components/Breadcrumb.vue';
import { Splitpanes, Pane } from 'splitpanes';
let { proxy }: any = getCurrentInstance();
import { VxeMessage, VxeNotifyType } from '@/utils/CommonMessage'; //提示框
import { isEmpty } from 'lodash';
import { funBdsJsResult } from '@/utils/Expression'; //函数公式
import SelectDataList from '@/components/SelectDataList.vue';
import BacReqPurposeDetail from './StaReqPurposeDetail.vue';
import BacReqPurposeBxInfo from './StaReqPurposeBxInfo.vue';
import BacReqSampleType from '../lab_sys/bac_set/BacReqSampleType.vue';
import { AppStore } from '@/stores/store';
defineExpose({ initPage });

let store = AppStore();
let searchForm = {
  searchValue: '',
  rptGroup: ''
};
let tloading = ref(false); //加载状态
let activeName = ref('first');
let purposeList: any = reactive([]);
let rptGroupList: any = reactive([]);
let smearFlagList: any = reactive([]); //选择字典
let sltPurpose: any = ref({});
let purposeDetailRef: any = ref(null);
let purposeBxInfoRef: any = ref(null);
let sampleTypeRef: any = ref(null);

let purposeForm = reactive({
  id: null,
  purposeNo: '',
  purposeName: '',
  sampleTypeId: '',
  sampleTypeCode: '',
  sampleTypeName: '',
  sampleRemark: '',
  workFlowId: '',
  workFlowName: '',
  flowNo: '',
  cultureCombinationId: '',
  culComninaNo: '',
  cultureCombinationName: '',
  sampleNoRule: '',
  sampleNoRuleName: '',
  inputCode: '',
  smearFlag: '',
  minReportHour: 0,
  maxReportHour: 0,
  exbarCount: null,
  defInputMdl: '',
  purposeKind: '',
  rptGroup: '',
  bxCulCombinaNos: '',
  bloodCulture: false,
  bxFlowNo: '',
  ygFlag: false,
  seq: 1,
  orgId: ''
});

let purposeFormRule = {
  purposeName: [
    {
      required: true,
      message: '请输入检验目的名称',
      trigger: 'blur'
    },
    {
      min: 2,
      max: 20,
      message: '长度为2到20个字符',
      trigger: 'blur'
    }
  ],
  purposeNo: [
    {
      required: true,
      message: '请输入检验目的代码',
      trigger: 'blur'
    }
  ]
};

function initPage() {
  findRptGroupList();
  findPurposeList(); // 获取质控规则表格数据
  getDictItemsList();
}

//批量获取字典
async function getDictItemsList() {
  let dictTreeTypeCodes: any = ['smearFlag'];

  const codes = dictTreeTypeCodes.join(',');
  const url = '/api/sys/basDictDetail/findDictDetailListByDictCodes';
  const dictTreeTypeItems: any = await proxy.$http.get(url, { params: { code: codes } });
  const smearFlagType = dictTreeTypeItems.data.find((item) => item.code === 'smearFlag');
  smearFlagList.push(...smearFlagType.detailDataList);
}

function findRptGroupList() {
  rptGroupList.length = 0; //放入数据前清空数据
  const url = '/api/rptGroup/findRptGroupList';
  proxy.$http
    //注意此处的数据条数
    .get(url, {
      params: { seachValue: '' }
    })
    .then((res: any) => {
      rptGroupList.push(...res.data);
    })
    .catch((err: any) => {
      VxeMessage('获取左侧仪器表格数据异常', VxeNotifyType.error);
    });
}

function tabHandleClick(tab) {
  if (tab.index == 1) {
    purposeDetailRef.value.initPage(purposeForm);
  } else if (tab.index == 2) {
    purposeBxInfoRef.value.initPage(purposeForm);
  } else if (tab.index == 3) {
    sampleTypeRef.value.initPage(purposeForm);
  }
}
// 回车查询
function keyupEnter(e: any) {
  if (e.$event.code == 'Enter') {
    findPurposeList();
  }
}
function valueChangeEvent() {
  findPurposeList();
}

function findPurposeList() {
  tloading.value = true;
  purposeList.length = 0; //放入数据前清空数据
  const url = '/api/sta/staReqPurpose/findPurposeList';
  proxy.$http
    //注意此处的数据条数
    .get(url, {
      params: {
        seachValue: searchForm.searchValue,
        rptGroup: searchForm.rptGroup
      }
    })
    .then((res: any) => {
      purposeList.push(...res.data);
      tloading.value = false;
      const kn = purposeList.find((k) => k.id == sltPurpose.value.id);
      if (isEmpty(kn)) {
        purposeRowClick({ row: purposeList[0] }); //默认选中第一条数据
      } else {
        purposeRowClick({ row: kn }); //默认选中第一条数据
      }
    })
    .catch((err: any) => {
      tloading.value = false;
      // VxeMessage('获取获取当前字典的规则列表失败',VxeNotifyType.error)
    });
}

function purposeRowClick({ row }: any) {
  if (isEmpty(row)) {
    clearForm();
  } else {
    (proxy.$refs.purposeTableRef as any).setCurrentRow(row);
    setPurposeForm(row);
    if (activeName.value == 'second') {
      purposeDetailRef.value.initPage(purposeForm);
    } else if (activeName.value == 'third') {
      purposeBxInfoRef.value.initPage(purposeForm);
    } else if (activeName.value == 'four') {
      sampleTypeRef.value.initPage(purposeForm);
    }
  }
}

function addPurposeDialog() {
  sltPurpose.value = {};

  clearForm();
  (proxy.$refs.purposeTableRef as any).clearCurrentRow();
  activeName.value = 'first';
}
function savePurpose(formName: any) {
  let $el = proxy.$refs[formName];
  $el.validate((valid: any) => {
    if (!valid) {
      return false;
    }
    let url = '';
    if (purposeForm.id == null) {
      url = '/api/sta/staReqPurpose/addPurpose';
    } else {
      // 修改用户
      url = '/api/sta/staReqPurpose/editPurpose';
    }

    const purpose = {
      id: purposeForm.id,
      purposeNo: purposeForm.purposeNo,
      purposeName: purposeForm.purposeName,
      sampleTypeId: purposeForm.sampleTypeId,
      sampleTypeCode: purposeForm.sampleTypeCode,
      sampleRemark: purposeForm.sampleRemark,
      workFlowId: purposeForm.workFlowId,
      flowNo: purposeForm.flowNo,
      cultureCombinationId: purposeForm.cultureCombinationId,
      culComninaNo: purposeForm.culComninaNo,
      sampleNoRule: purposeForm.sampleNoRule,
      inputCode: purposeForm.inputCode,
      smearFlag: purposeForm.smearFlag,
      minReportHour: purposeForm.minReportHour,
      maxReportHour: purposeForm.maxReportHour,
      exbarCount: purposeForm.exbarCount,
      defInputMdl: purposeForm.defInputMdl,
      purposeKind: purposeForm.purposeKind,
      rptGroup: purposeForm.rptGroup,
      bloodCulture: purposeForm.bloodCulture,
      bxFlowNo: purposeForm.bxFlowNo,
      ygFlag: purposeForm.ygFlag,
      seq: purposeForm.seq,
      orgId: isEmpty(purposeForm.orgId) ? store.userInfo.orgId : purposeForm.orgId
    };
    proxy.$http
      .post(url, purpose)
      .then((res: any) => {
        VxeMessage('保存成功', VxeNotifyType.success);
        clearForm();
        sltPurpose.value.id = res.data.id;
        findPurposeList();
      })
      .catch((err: any) => {
        VxeMessage('保存失败', VxeNotifyType.error);
      });
  });
}
function deleteBatchPurpose() {
  const sltPurposes = (proxy.$refs.purposeTableRef as any).getCheckboxRecords();
  if (!(sltPurposes.length > 0)) {
    VxeMessage('请勾选要删除的数据', VxeNotifyType.info);
  } else {
    proxy
      .$confirm('确定要删除当前勾选的数据？', '提示', {
        cancelButtonClass: 'cancel-button',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
      .then(() => {
        const data = { purposeList: sltPurposes };
        const url = '/api/sta/staReqPurpose/batchDeletePurposeList';
        proxy.$http
          .post(url, data)
          .then((res: any) => {
            if (res.status.code === 1) {
              findPurposeList(); // 获取检验仪器表格数据
              VxeMessage('删除成功', VxeNotifyType.success);
            } else {
              VxeMessage(res.status.msg, VxeNotifyType.error);
            }
          })
          .catch((err: any) => {
            VxeMessage(err, VxeNotifyType.error);
          });
      })
      .catch((err: any) => {
        // VxeMessage(err, VxeNotifyType.error);
      });
  }
}
function clearForm() {
  purposeForm.id = null;
  purposeForm.purposeNo = '';
  purposeForm.purposeName = '';
  purposeForm.sampleTypeId = '';
  purposeForm.sampleTypeName = '';
  purposeForm.sampleRemark = '';
  purposeForm.workFlowId = '';
  purposeForm.workFlowName = '';
  purposeForm.cultureCombinationId = '';
  purposeForm.cultureCombinationName = '';
  purposeForm.sampleNoRule = '';
  purposeForm.sampleNoRuleName = '';
  purposeForm.inputCode = '';
  purposeForm.smearFlag = '';
  purposeForm.minReportHour = 0;
  purposeForm.maxReportHour = 0;
  purposeForm.exbarCount = null;
  purposeForm.defInputMdl = '';
  purposeForm.purposeKind = '';
  purposeForm.rptGroup = '';
  purposeForm.bloodCulture = false;
  purposeForm.ygFlag = false;
  purposeForm.seq = purposeList.length + 1;
  purposeForm.orgId = '';
}

function setPurposeForm(row: any) {
  Object.assign(purposeForm, row);
  // purposeForm.id = row.id;
  // purposeForm.purposeNo = row.purposeNo;
  // purposeForm.purposeName = row.purposeName;
  // purposeForm.sampleTypeId = row.sampleTypeId;
  // purposeForm.sampleTypeName = row.sampleTypeName;
  // purposeForm.sampleRemark = row.sampleRemark;
  // purposeForm.workFlowId = row.workFlowId;
  // purposeForm.workFlowName = row.workFlowName;
  // purposeForm.cultureCombinationId = row.cultureCombinationId;
  // purposeForm.cultureCombinationName = row.cultureCombinationName;
  // purposeForm.sampleNoRule = row.sampleNoRule;
  // purposeForm.sampleNoRuleName = row.sampleNoRuleName;
  // purposeForm.inputCode = row.inputCode;
  // purposeForm.smearFlag = row.smearFlag;
  // purposeForm.minReportHour = row.minReportHour;
  // purposeForm.maxReportHour = row.maxReportHour;
  // purposeForm.exbarCount = row.exbarCount;
  // purposeForm.defInputMdl = row.defInputMdl;
  // purposeForm.purposeKind = row.purposeKind;
  // purposeForm.rptGroup = row.rptGroup;
  // purposeForm.bloodCulture = row.bloodCulture;
  // purposeForm.ygFlag = row.ygFlag;
  // purposeForm.seq = row.seq;
  // purposeForm.orgId = row.orgId;
  sltPurpose.value = row;
}

function sampleTypeSelect(row) {
  purposeForm.sampleTypeId = row.id;
  purposeForm.sampleTypeName = row.sampleTypeName;
  purposeForm.sampleTypeCode = row.sampleTypeCode;
}
function clearSampleTypeName() {
  purposeForm.sampleTypeId = '';
  purposeForm.sampleTypeName = '';
  purposeForm.sampleTypeCode = '';
}

function sliceSampleTypeHandler() {
  let newStr = purposeForm.sampleTypeName.slice(0, -1);
  purposeForm.sampleTypeName = newStr;
}

function workFlowSelect(row) {
  purposeForm.workFlowId = row.id;
  purposeForm.workFlowName = row.workFlowName;
  purposeForm.flowNo = row.workFlowCode;
}
function clearWorkFlowName() {
  purposeForm.workFlowId = '';
  purposeForm.workFlowName = '';
  purposeForm.flowNo = '';
}
function sliceWorkFlowHandler() {
  let newStr = purposeForm.workFlowName.slice(0, -1);
  purposeForm.workFlowName = newStr;
}

function sampleNoRuleSelect(row) {
  purposeForm.sampleNoRule = row.id;
  purposeForm.sampleNoRuleName = row.ruleName;
}
function clearSampleNoRuleName() {
  purposeForm.sampleNoRule = '';
  purposeForm.sampleNoRuleName = '';
}
function sliceSampleNoRuleHandler() {
  let newStr = purposeForm.sampleNoRuleName.slice(0, -1);
  purposeForm.sampleNoRuleName = newStr;
}

function cultureCombinationSelect(row) {
  purposeForm.cultureCombinationId = row.id;
  purposeForm.cultureCombinationName = row.name;
  purposeForm.culComninaNo = row.code;
}
function clearCultureCombinationName() {
  purposeForm.cultureCombinationId = '';
  purposeForm.cultureCombinationName = '';
  purposeForm.culComninaNo = '';
}
function sliceCultureCombinationHandler() {
  let newStr = purposeForm.cultureCombinationName.slice(0, -1);
  purposeForm.cultureCombinationName = newStr;
}

function getBdsResult() {
  purposeForm.inputCode = funBdsJsResult('firstPinYinFun', purposeForm.purposeName);
}

function formatCommon(arr, value) {
  for (const item of arr) {
    if (item.code == value) {
      return item.name;
    }
  }
}
</script>

<style lang="scss" scoped>
#purposeDiv {
  height: 100%;
  .bodyContent {
    height: calc(100% - 60px);
    .splitpanes {
      background-color: $base-white;
      // 附加按钮间距
      .button-blue,
      .button-red {
        margin: 5px 0 5px 5px;
      }
      .tableBody {
        height: calc(100% - 40px - 32px);
      }
      .el-tabs {
        height: 100%;
        :deep(.el-tabs__content) {
          height: calc(100% - 40px);
          padding: 0;
          .el-tab-pane {
            height: 100%;
          }
          #pane-first {
            padding: 15px;
          }
        }
      }
    }
  }
}
</style>
